package leetcode;

public class LeetCodeMain124 {
    public int singleNumber(int[] nums) {
        int num=0;
        for (int i = 0; i < 32; i++) {
            int target=0;
            for (int n:nums) {
                if ((n&(1<<i))!=0){
                    target++;
                }
            }
            if (target%3!=0){
                num^=(1<<i);
            }
        }
        return num;
    }
}
